chore: Add type stubs for Django and rest#328
Conversation
I assume you are type checking locally? I don't see the tool you are using or any readme information on how you would use these stubs. Do you also want to add 'mypy' or 'ty' to the requirements to make it complete? |
The reasoning for adding this was: Yes. My nvim, as well as vscode and zed will run typecheckers on python by default. But: This PR is not to introduce typing. Nor to fix actual potential bugs found by typing. Obv. I can disable my editor(s) from typechecking on certain projects/branches etc, but I find it highly beneficial to:
I personally prefer basedpyright (long story); but any one is good enough. Without these stubs, typing is unusable, so we lack the option to use the IDEs typechecking, type-hinting, etc. But also, inline documentation, smart, scoped, auto-complete, "goto definition", "rename symbol" and so on (aka LSP, aka intellisense), are not avaiable in the editor, or are rather unusable on anything "Django" (models, etc) Also, without the stubs, literally hundreds of warnings and errors that are not a problem spam the project. Hiding actual problems. This goes for any code, also new files or new classes that use Django features like models. |
5d0b7d8 to
eff8b9d
Compare
This "fixes" several hundreds of typing errors and warnings. Leaving us with several hundred of relevant warnings and about fifty relevant and potentially problematic errors. Add development dependencies and installation instructions Add requirements-dev.txt with type stubs for Django and DRF Update installation docs in README, dev.Dockerfile and S3_STORAGE_SETUP.md Include dev dependencies installation step in all relevant docs
eff8b9d to
84b5527
Compare
ThomasKalverda
left a comment
There was a problem hiding this comment.
Alright, I prefer to either support typing fully in the project or only locally, but I can see why only locally would be annoying during development (installing the stubs every time). As this is a legacy project that doesn't have to be perfect anymore, I'm fine with adding stuff like this to improve DX 👌
This "fixes" several hundreds of typing errors and warnings. Leaving us with several hundred of relevant warnings and about fifty relevant and potentially problematic errors.
Backported from feature/ewi
Add development dependencies and installation instructions
Add requirements-dev.txt with type stubs for Django and DRF Update installation docs in README, Dockerfile and
Include dev dependencies installation step in all relevant docs